import {Dialog, Notify} from "quasar";


function ToastInfo(msg: string,timeout =2000) {
    Notify.create({
        message: msg,
        position: "top",
        textColor: "white",
        color: "green",
        timeout: timeout
    })
}

function ToastError(msg: string,timeout =2000) {
    Notify.create({
        message: msg,
        position: "top",
        textColor: "white",
        color: "red",
        timeout: timeout
    })
}


function DelConfirm(msg: string, title: string = "删除确认") {
    return new Promise<boolean>((resolve) => {
        Dialog.create({
            title: title,
            message: msg,
            cancel: true,
            persistent: true,
        })
            .onOk(() => {
                resolve(true);
            })
            .onCancel(() => {
                resolve(false);
            });
    });
}

export {ToastError, ToastInfo,DelConfirm}